//
//  TestCollectImageCVC.swift
//  jhf
//
//  Created by 计海峰 on 2021/12/3.
//  Copyright © 2021 CocoaPods. All rights reserved.
//

import UIKit
import CooperSwift

class TestCollectImageCVCModel: NSObject, CollectionCellLongPressConfigProtocol, BindKeyProtocol {

    func cellCls() -> UICollectionViewCell.Type {
        return TestCollectImageCVC.self
    }
    
    var model: Any?
    
    required init(_ model: Any?) {
        super.init()
        self.model = model
        self.cellSize = CGSize(Screen.width/3.0 - 0.01, Screen.width/3.0 - 0.01)
    }
    
}


class TestCollectImageCVC: UICollectionViewCell {

    @IBOutlet weak var btn: UIButton!
    
    
    @IBAction func removeTap(_ sender: Any) {
        guard let model = self.info as? TestCollectImageCVCModel else { return }
        model.postCollectionService(.removeItem)
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
//        contentView.backgroundColor = .random()
    }
    
    override func bindTo(_ info: Any?) {
        super.bindTo(info)
        guard let model = info as? TestCollectImageCVCModel else { return }
        btn.setTitle(model.model as? String ?? "", for: .normal)
    }

}
